import { Size, TERRAIN_BLOCK_VERTEX_SIZE, Vec2 } from "cc";

export const Vec2Dir = {
    Left : new Vec2(-1, 0),
    Right: Vec2.UNIT_X,
    Up: Vec2.UNIT_Y,
    Down: new Vec2(0, -1)
}

export const MAP_RES_PATH = 'mapsdata/'
export const TANK_SIZE = new Size(16, 16)
export const HALF_TANK_SIZE = new Size(TANK_SIZE.width / 2, TANK_SIZE.height / 2)
export const MAP_SIZE = new Size(26, 26)
export const BLOCK_SIZE = new Size(8, 8)
export const HALF_BLOCK_SIZE = new Size(BLOCK_SIZE.width / 2, BLOCK_SIZE.height / 2)
export const BULLET_SIZE = new Size(8, 8)
export const HALF_BULLET_SIZE = new Size(BULLET_SIZE.width / 2, BULLET_SIZE.height / 2)
export const BASE_SIZE = new Size(16, 16)
export const BASE_MAP_POS = [new Vec2(12, 24), new Vec2(13, 24), new Vec2(12, 25), new Vec2(13, 25)]

export const PLAYER_INVINCIBLE_TIME = 1.0
export const PLAYER_CONFIG_ID = 103
export const TANK_RES_PATH = 'texture/tank/'
export const TANK_CONFIG = [
    {id: 101, res: TANK_RES_PATH + 'tank_white_1', speed: 50, clipName: 'white_1'},
    {id: 102, res: TANK_RES_PATH + 'tank_red_1', speed: 50, clipName: 'red_1'},
    {id: 103, res: TANK_RES_PATH + 'tank_yellow_1', speed: 50, clipName: 'yellow_1'},
    {id: 201, res: TANK_RES_PATH + 'tank_white_2', speed: 50, clipName: 'white_2'},
    {id: 202, res: TANK_RES_PATH + 'tank_red_2', speed: 50, clipName: 'red_2'},
    {id: 203, res: TANK_RES_PATH + 'tank_yellow_2', speed: 50, clipName: 'yellow_2'},
]
type TANK_CONFIG_TYPE = typeof TANK_CONFIG[0]
export const TANK_CONFIG_MAP: {[id: number]: TANK_CONFIG_TYPE} = {}
TANK_CONFIG.forEach(element => {
    TANK_CONFIG_MAP[element.id] = element
});

export const AUDIO_RES_PATH = 'audio/'